package test.com.sky.designPattern.statePattern;

import com.sky.JULLog.MyLogger;

import java.util.logging.Logger;

public class ClosingState extends LiftState {

    private Logger log = MyLogger.getLogger(ClosingState.class) ;


    ClosingState(Lift lift) {
        super(lift);
    }


    @Override
    public void open() {
        // 执行开门动作
        // 1、变化为开门状态
        this.lift.setState(lift.getOpeningState());
        // 2、开门
        this.lift.open();
    }

    @Override
    public void close() {
        log.severe("关门状态不能执行关门动作!");
    }

    @Override
    public void run() {
        // 运行动作
        // 1、运行状态
        this.lift.setState(lift.getRunningState());
        // 2、运行动作
        this.lift.run();
    }

    @Override
    public void stop() {
        // 停止动作
        // 1、转化为停止状态
        this.lift.setState(lift.getStoppingState());
        // 2、停止
        this.lift.stop();
    }

}
